Skip to content

[build] Do not do process isolation on win or mac #3441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 10, 2025

Conversation

clee2000
Copy link
Contributor

@clee2000 clee2000 commented Jul 9, 2025

multiprocess defaults to spawn on macs and fork on linux, and I think sphinx makes everything in conf.py be in the main module even if you import from another file so its not picklable, so you get errors like

Handler <function generate_gallery_rst at 0x31029b920> for event 'builder-inited' threw an exception (exception: Can't pickle <function call_fn at 0x107e14860>: attribute lookup call_fn on __main__ failed)

or if you try to put call_fn in a different file:

Handler <function generate_gallery_rst at 0x17c59b920> for event 'builder-inited' threw an exception (exception: Can't pickle <function generate_file_rst at 0x1412322a0>: it's not the same object as sphinx_gallery.gen_rst.generate_file_rst)

Mac does have fork, but MPS doesn't, and windows doesn't support fork, so don't monkey patch if on either of these platforms

Testing: Ran make html-noplot and saw that it got past the place it originally errored. Not testable in CI because we don't currently have mac builds in CI

Notes:
multiprocess + mac wants spawn b/c MPS stuff -> needs to be picklable -> some inputs to generate file rst not pickleable
Could probably manually pickle with cloudpickle since sphinx gallery later versions use joblib which use cloudpickle but this seems like overkill

Copy link

pytorch-bot bot commented Jul 9, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3441

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 17251ef with merge base 876c563 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@svekars svekars added the build issue Issues relating to the tutorials build label Jul 9, 2025
@clee2000 clee2000 changed the title Fix isolation subprocess monkey patching on macs [build] Fix isolation subprocess monkey patching on macs Jul 9, 2025
@clee2000 clee2000 changed the title [build] Fix isolation subprocess monkey patching on macs [build] Do not do process isolation on win or mac Jul 9, 2025
@clee2000 clee2000 force-pushed the csl/fix_isolation_macs branch from b376541 to 34b76b7 Compare July 9, 2025 20:55
@clee2000 clee2000 force-pushed the csl/fix_isolation_macs branch from 34b76b7 to 91e1705 Compare July 9, 2025 20:55
Copy link
Contributor

@svekars svekars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worked for me.

@clee2000 clee2000 merged commit 6d169f6 into main Jul 10, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build issue Issues relating to the tutorials build cla signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants